The Scripting app provides access to daily activity summary data from Apple Health using the global function Health.queryActivitySummaries()
. These summaries represent Move, Exercise, and Stand goals tracked by Apple Watch, along with completion metrics and historical trends.
This API is ideal for displaying daily ring data or analyzing long-term fitness trends.
An HealthActivitySummary
provides a high-level overview of a day’s Apple Watch activity:
Move (Active Energy Burned)
activeEnergyBurned(unit: HealthUnit): number
activeEnergyBurnedGoal(unit: HealthUnit): number
Exercise (Minutes)
appleExerciseTime(unit: HealthUnit): number
appleExerciseTimeGoal(unit: HealthUnit): number
Stand (Hours)
appleStandHours(unit: HealthUnit): number
appleStandHoursGoal(unit: HealthUnit): number
Date Information
dateComponents: DateComponents
– a DateComponents
object containing at least year, month, and day.Parameter | Type | Description |
---|---|---|
start |
DateComponents |
The start of the query range. Only summaries on or after this date are returned. |
end |
DateComponents |
The end of the query range. Only summaries on or before this date are returned. |
If you omit the options, the API returns all available summaries (up to system limits). Summaries are returned sorted by date in ascending order.
number
in the specified unit.HealthUnit
factory methods (e.g., kilocalorie()
, minute()
, count()
) to specify units.Health.queryActivitySummaries({ start, end })
with DateComponents
to specify your date range.HealthActivitySummary
, sorted ascending by date.